home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 146
/
(Vol 146) Jan 07 2012.iso
/
Games
/
super_fly.swf
/
scripts
/
DefineSprite_71
/
frame_22
/
DoAction.as
Wrap
Text File
|
2012-01-07
|
2KB
|
94 lines
call("pickAfly");
mouse_x = getProperty("../flyin" add pickedOff add "/fly1", _X);
mouse_y = getProperty("../flyin" add pickedOff add "/fly1", _Y);
tellTarget("../flyin" add pickedOff)
{
gotoAndStop(1);
}
s_x = getProperty("../fTong", _X);
s_y = getProperty("../fTong", _Y);
x_dist = mouse_x - s_x;
y_dist = mouse_y - s_y;
input = y_dist * y_dist + x_dist * x_dist;
call("sqroot");
tongLength = tongLength;
pi = "3.1416";
deltax = mouse_x - s_x;
deltay = mouse_y - s_y;
ratio = deltay / deltax;
if("0" < deltax)
{
if("1" < ratio)
{
input = "1" / ratio;
call("arctan");
angle = "90" - output * "180" / pi;
}
else if("0" < ratio and ratio < "1")
{
input = ratio;
call("arctan");
angle = output * "180" / "3.14";
}
else if(ratio < "0" and - "1" < ratio)
{
input = ratio;
call("arctan");
angle = "360" + output * "180" / "3.14";
}
else if(ratio < - "1")
{
input = "1" / ratio;
call("arctan");
angle = "270" - output * "180" / pi;
}
}
else if(deltax < "0")
{
if("1" < ratio)
{
input = "1" / ratio;
call("arctan");
angle = "270" - output * "180" / pi;
}
else if("0" < ratio and ratio < "1")
{
input = ratio;
call("arctan");
angle = "180" + output * "180" / "3.14";
}
else if(ratio < "0" and - "1" < ratio)
{
input = ratio;
call("arctan");
angle = "180" + output * "180" / "3.14";
}
else if(ratio < - "1")
{
input = "1" / ratio;
call("arctan");
angle = "90" - output * "180" / pi;
}
}
else if(deltax == "0")
{
if("0" < deltay)
{
angle = "90";
}
else if(deltay < "0")
{
angle = - "90";
}
else if(deltay == "0")
{
angle = "null";
}
}
setProperty("fline", _rotation, angle);
set("fline:tongLength",tongLength);
tellTarget("fline")
{
gotoAndPlay(2);
}